var status = -1;
var selectionLog = [];
var rank = ["F", "D", "C", "B", "A", "S"];
var reqScore = [0, 25, 50, 75, 100, 150];
var box = [2028346, 2028345, 2028344, 2028343, 2028342, 2028338];

function start() {
    action(1, 0, 0)
}

function action(f, c, b) {
    if (status == 0 && f == 0) {
        cm.dispose();
        return
    }
    var e = cm.getNumberFromQuestInfo(59792, "score");
    var d = cm.getNumberFromQuestInfo(59792, "expCount");
    (f == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.sendNormalTalk_Bottom("#face0#获得总分: " + e + "分。\r\n奖励级别: " + rank[getRank(e)], 36, 9400057, false, true)
        } else {
            if (status === a++) {
                cm.sendNormalTalk_Bottom("#face0#欢迎您访问私营银河研究合作机关APORD的第6号研究船。\r\n下次再见吧。", 36, 9400057, true, true)
            } else {
                if (status === a++) {
                    cm.sendNormalTalk_Bottom("#face0#你可获得的经验值如下。" + d, 36, 9400057, true, true)
                } else {
                    if (status === a++) {
                        cm.gainItem(box[getRank(e)], 1);
                        cm.dispose();
                        cm.warp(867110000, 0);
                        cm.fieldEffect_KinesisEXP(d);
                        cm.gainExp(d);
                        cm.updateInfoQuest(59792, "killCount=0;expCount=0;score=0");
                        cm.updateInfoQuest(63864, "expCountEv=0");
                        cm.addNumberForQuestInfo(59790, "ClearCount", 1);
                        cm.addNumberForQuestInfo(59793, "count", 1)
                    }
                }
            }
        }
    }
}

function getRank(b) {
    for (var a = reqScore.length - 1; a >= 0; a--) {
        if (b >= reqScore[a]) {
            return a
        }
    }
    return 0
};